Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils + azure: vscode.dev migration work #1401

Merged
merged 36 commits into from
Mar 22, 2023
Merged

utils + azure: vscode.dev migration work #1401

merged 36 commits into from
Mar 22, 2023

Conversation

nturinski
Copy link
Member

TODO: There's still some commented out code that I need to fix before we can merge this, just getting the PR up

@nturinski nturinski requested a review from a team as a code owner March 13, 2023 23:09
azure/src/index.ts Outdated Show resolved Hide resolved
azure/src/azure-account.api.d.ts Show resolved Hide resolved
azure/package.json Outdated Show resolved Hide resolved
azure/package.json Outdated Show resolved Hide resolved
utils/package.json Outdated Show resolved Hide resolved
utils/src/createExperimentationService.ts Outdated Show resolved Hide resolved
utils/src/createTelemetryReporter.ts Outdated Show resolved Hide resolved
utils/src/registerReportIssueCommand.ts Outdated Show resolved Hide resolved
utils/src/utils/openUrl.ts Outdated Show resolved Hide resolved

test('operationSpec with expected error', async () => {
testResponses = [{ status: 404, body: 'oops' }];
//test('operationSpec with unexpected error', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we're still using operationSpec errors because it was our StatusCodePolicy pipeline controlling that. There are still some pipelines that I need to investigate into adding back in.

@@ -211,6 +209,10 @@ export function getDefaultWebpackConfig(options: DefaultWebpackOptions): webpack
"async_hooks": false,
"child_process": false,
"fs": false,
'html-to-text': false,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package is used to parse errors. I'm not sure how to really test it (because I don't see html errors often) but it's wrapped in a try/catch so I don't think that this should cause any exceptions to be thrown in a vscode.dev environment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hasn't this one given us CG alerts before? Just to parse errors feels like a pretty flimsy reason to keep it...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only used to parse error messages in case the error message is an html document, which seems somewhat common for Azure errors. See #360

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I couldn't quickly find any alternatives that are browser compatible, so 🤷

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh the irony...can't find a browser-compatible package to parse HTML

/**
* The Azure SDK will only throw errors for bad status codes if it has an "operationSpec", but none of our "generic" requests will have that
*/
class StatusCodePolicy implements PipelinePolicy {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically what we had before for the following reason:

The Azure SDK will only throw errors for bad status codes if it has an "operationSpec", but none of our "generic" requests will have that

OperationSpec isn't something that you can pass into the request anymore, but I believe it's built internally into the SDK. If the SDK call errors out, it throws the error during the pipeline. However, with generic requests, it will accept any status code as a resolved response, so we need to be checking the error and throwing it ourselves.

});

test('ECONNRESET', async () => {
await assertThrowsAsync(async () => await sendTestRequest(res => res.destroy()), /socket hang up/i);
});

// test('operationSpec with unexpected error', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned, we don't have operationSpec as a property anymore, so I removed these tests. The errors above basically test the same thing, which was the StatusCodePolicy

Copy link
Member Author

@nturinski nturinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I think I am done with all the PR feedback and other things that I wanted to test. So shouldn't be adding anymore changes to this one (unless there ends up being more feedback)

@alexweininger
Copy link
Member

Merge conflicts?

@nturinski
Copy link
Member Author

Okaaay, that is my last commit. Stupid version changes-- why can't git figure it out?

alexweininger
alexweininger previously approved these changes Mar 22, 2023
@nturinski
Copy link
Member Author

Need to release dev -> utils -> azure in that order to make fix the linting errors

@nturinski nturinski merged commit 1b173bc into main Mar 22, 2023
@nturinski nturinski deleted the nat/vscode-dev branch March 22, 2023 23:14
@bwateratmsft bwateratmsft linked an issue Apr 19, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use 'vscode.open' instead of the 'open'
3 participants